package com.sky.client;

import com.sky.dto.CategoryDTO;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import com.sky.result.PageResult;
import com.sky.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "sky-service-category")
public interface CategoryClient {

    /**
     * 新增分类
     * @param categoryDTO
     * @return
     */
    @PostMapping("/admin/category")
    Result<String> save(@RequestBody CategoryDTO categoryDTO);

    /**
     * 分类分页查询
     * @param categoryPageQueryDTO
     * @return
     */
    @GetMapping("/admin/category/page")
    Result<PageResult> page(@RequestParam CategoryPageQueryDTO categoryPageQueryDTO);

    /**
     * 删除分类
     * @param id
     * @return
     */
    @DeleteMapping("/admin/category")
    Result<String> deleteById(@RequestParam Long id);

    /**
     * 修改分类
     * @param categoryDTO
     * @return
     */
    @PutMapping("/admin/category")
    Result<String> update(@RequestBody CategoryDTO categoryDTO);

    /**
     * 启用、禁用分类
     * @param status
     * @param id
     * @return
     */
    @PostMapping("/admin/category/status/{status}")
    Result<String> startOrStop(@PathVariable("status") Integer status, @RequestParam Long id);

    /**
     * 根据类型查询分类
     * @param type
     * @return
     */
    @GetMapping("/admin/category/list")
    Result<List<Category>> list(@RequestParam Integer type);
}
